import React, { Component } from 'react';
import Son from './son'
class fatherDemo extends Component {
    constructor(props) {
        super(props);
        this.state = {
            name:'六道',
            sex:'man',
            age:'29'
        }
        this.count=0
        this.son=React.createRef()
    }
    componentDidMount(){
       this.son.current.sonFun(1111);
    }
    doSomeThing(){
        this.son.current.sonFun(++this.count);
    }
    shouldComponentUpdate(){
        
    }
    render() {
        console.log('父组件更新了');
        return (
            <div>
                <button onClick={this.doSomeThing.bind(this)}></button>
                <p>这是父组件</p>
                <Son ref={this.son} count={this.count}/>
            </div>
        );
    }
}
 
export default fatherDemo
